/*
 * @Author: chen haoxuan
 * @Date: 2021-05-24 22:27:55
 * @LastEditTime: 2021-05-24 23:28:14
 */
#include<iostream>
using namespace std;
class Matrix
{
  public:
    Matrix(){matrix[2][3]={0};}
    Matrix operator+(Matrix &);
    friend istream& operator >>(istream&,Matrix&);
    friend ostream& operator <<(ostream&,Matrix&);
  private:
    int matrix[2][3];  
};
ostream& operator <<(ostream& output,Matrix &c)
{
  for (int i = 0; i < 2; i++)
  {
    for (int k = 0; k < 3; k++)
    {
      output<<c.matrix[i][k]<<" ";
    }
    cout<<endl;
  }
  return output;
}
istream& operator >>(istream& input,Matrix &c)
{
    cout<<"Please a 2x3 matrix: "<<endl;
    for (int i = 0; i < 2; i++)
    {
      for (int k = 0; k < 3; k++)
      {
        input>>c.matrix[i][k];
      }
      
    }
   return input; 
}
Matrix Matrix::operator+(Matrix &c)
{
  Matrix temp;
    temp.matrix[2][3] = {0};
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            temp.matrix[i][j] = matrix[i][j] + c.matrix[i][j];
        }
    }
    return temp;
}
int main()
{
  Matrix m1,m2,m3;
  cin>>m1;
  cout<<"m1 = "<<endl<<m1;
  cin>>m2;
  cout<<"m2 = "<<endl<<m2;
  m3=m1+m2;
  cout<<"m3 = "<<endl<<m3;
  system("pause");
  return 0;
}